<template>
    <el-dialog
    :title="text"
    :visible.sync="visi"
    :width="widv"
    :fullscreen="full"
    :modal="mask"
    :lock-scroll="lock"
    :custom-class="addc"
    :close-on-click-modal="mocl"
    :close-on-press-escape="escl"
    :show-close="tbsh"
    :before-close="uadialogCancel">
        <slot></slot>
        <span slot="footer" class="dialog-footer">
            <el-button :type="fasty" :size="btnsz" :icon="faico"
                :plain="fatyp==2?true:false"
                :round="fatyp==3?true:false"
                :circle="fatyp==4?true:false"
                :loading="fatyp==5?true:false"
                :disabled="fatyp==6?true:false"
            @click="uadialogCancel" v-if="faSta">{{faTxt}}</el-button>
            <el-button :type="trsty" :size="btnsz"  :icon="trico"
                :plain="trtyp==2?true:false"
                :round="trtyp==3?true:false"
                :circle="trtyp==4?true:false"
                :loading="trtyp==5?true:false"
                :disabled="trtyp==6?true:false"
            @click="uadialogSubmit">{{trTxt}}</el-button>
        </span>
    </el-dialog>
</template>
<script>
  export default {
    name:"ua-dialog",
    props : {
        text :{type:String,default:'弹窗名称'},
        visi :{type:Boolean,default:true },
        widv :{type:String,default:'500px'},
        mask :{type:Boolean,default:true },
        full :{type:Boolean,default:false },
        lock :{type:Boolean,default:true },
        addc :{type:String,default:""},
        mocl :{type:Boolean,default:true },
        escl :{type:Boolean,default:true},
        tbsh :{type:Boolean,default:false},

        btnsz:{type:String,default:''},

        trTxt:{type:String,default:"确定"},
        trFun:{type:Function,default:() => {}},
        trtyp:{type:Number,default:1},
        trsty:{type:String,default:'primary'},
        trico:{type:String,default:''},

        faTxt:{type:String,default:"取消"},
        faFun:{type:Function,default:() => {}},
        fatyp:{type:Number,default:1},
        fasty:{type:String,default:''},
        faico:{type:String,default:''},
        faSta:{type:Boolean,default:true },
        
    },
    data() {
        return {
            
        };
    },
    mounted(){
        // console.log(this);
    },
    methods: {
        uadialogSubmit(){
            this.trFun();
            this.$emit('uadialogSubmitAction','1');
        },
        uadialogCancel(){
            this.faFun();
            this.$emit('uadialogSubmitAction','0');
        }
    }
  };
</script>

